import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '店铺名称',
    align:"center",
    dataIndex: 'store'
   },
   {
    title: '店铺ID',
    align:"center",
    dataIndex: 'storeId'
   },
   {
    title: '客户名称',
    align:"center",
    dataIndex: 'customer'
   },
   {
    title: '站点',
    align:"center",
    dataIndex: 'site'
   },
   {
    title: 'PM',
    align:"center",
    dataIndex: 'pm'
   },
   {
    title: 'TL',
    align:"center",
    dataIndex: 'tl'
   },
   {
    title: '店铺账号',
    align:"center",
    dataIndex: 'storeAccount'
   },
   {
    title: '类目',
    align:"center",
    dataIndex: 'category_dictText'
   },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createTime'
   },
   {
    title: '修改时间',
    align:"center",
    dataIndex: 'updateTime'
   },
   {
    title: '操作人',
    align:"center",
    dataIndex: 'createBy'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "店铺名称",
      field: 'store',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "客户名称",
      field: 'customer',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "站点",
      field: 'site',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "PM",
      field: 'pm',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "TL",
      field: 'tl',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "店铺账号",
      field: 'storeAccount',
      component: 'Input',
      //colProps: {span: 6},
 	},
     {
      label: "创建时间",
      field: "createTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
     {
      label: "修改时间",
      field: "updateTime",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	},
	{
      label: "操作人",
      field: 'createBy',
      component: 'Input',
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '店铺名称',
    field: 'store',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入店铺名称!'},
          ];
     },
  },
  {
    label: '店铺ID',
    field: 'storeId',
    component: 'Input',
  },
  {
    label: '客户名称',
    field: 'customer',
    component: 'Input',
  },
  {
    label: '站点',
    field: 'site',
    component: 'Input',
  },
  {
    label: 'PM',
    field: 'pm',
    component: 'Input',
  },
  {
    label: 'TL',
    field: 'tl',
    component: 'Input',
  },
  {
    label: '店铺账号',
    field: 'storeAccount',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入店铺账号!'},
                 { pattern: '(^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$)|(^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$)', message: '不符合校验规则!'},
          ];
     },
  },
  {
    label: '类目',
    field: 'category',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"category"
     },
  },
  {
    label: '登录密码',
    field: 'loginPassword',
    component: 'InputPassword',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  store: {title: '店铺名称',order: 0,view: 'text', type: 'string',},
  storeId: {title: '店铺ID',order: 1,view: 'text', type: 'string',},
  customer: {title: '客户名称',order: 2,view: 'text', type: 'string',},
  site: {title: '站点',order: 3,view: 'text', type: 'string',},
  pm: {title: 'PM',order: 4,view: 'text', type: 'string',},
  tl: {title: 'TL',order: 5,view: 'text', type: 'string',},
  storeAccount: {title: '店铺账号',order: 6,view: 'text', type: 'string',},
  category: {title: '类目',order: 7,view: 'list', type: 'string',dictCode: 'category',},
  createTime: {title: '创建时间',order: 8,view: 'datetime', type: 'string',},
  updateTime: {title: '修改时间',order: 9,view: 'datetime', type: 'string',},
  createBy: {title: '操作人',order: 10,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}